package com.aim.game;

/**
 * Created with IntelliJ IDEA.
 * User: User
 * Date: 4/28/14
 * Time: 10:49 PM
 * To change this template use File | Settings | File Templates.
 */
public class CostTable {

    private static int OCCUR_INDEX = 0;
    private static int ACTION_INDEX = 1;
    private static int TIME_INDEX = 2;

    private double[][] mechanicalActionCostTable = new double[4][3];

    public CostTable(double maintenanceAction, double maintenanceTime,
                     double minorOccur, double minorAction, double minorTime,
                     double moderateOccur, double moderateAction, double moderateTime,
                     double severeOccur, double severeAction, double severeTime){

        mechanicalActionCostTable[MC.FIX.index][OCCUR_INDEX] = 0;
        mechanicalActionCostTable[MC.FIX.index][ACTION_INDEX] = maintenanceAction;
        mechanicalActionCostTable[MC.FIX.index][TIME_INDEX] = maintenanceTime;

        mechanicalActionCostTable[MC.M1.index][OCCUR_INDEX] = minorOccur;
        mechanicalActionCostTable[MC.M1.index][ACTION_INDEX] = minorAction;
        mechanicalActionCostTable[MC.M1.index][TIME_INDEX] = minorTime;

        mechanicalActionCostTable[MC.M2.index][OCCUR_INDEX] = moderateOccur;
        mechanicalActionCostTable[MC.M2.index][ACTION_INDEX] = moderateAction;
        mechanicalActionCostTable[MC.M2.index][TIME_INDEX] = moderateTime;

        mechanicalActionCostTable[MC.M3.index][OCCUR_INDEX] = severeOccur;
        mechanicalActionCostTable[MC.M3.index][ACTION_INDEX] = severeAction;
        mechanicalActionCostTable[MC.M3.index][TIME_INDEX] = severeTime;
    }

    public CostTable() {
    }

    public double getOccurCost(MC mechanicalCondition){
        return mechanicalActionCostTable[mechanicalCondition.index][OCCUR_INDEX];
    }

    public double getActionCost(MC mechanicalCondition){
        return mechanicalActionCostTable[mechanicalCondition.index][ACTION_INDEX];
    }

    public long getTime(MC mechanicalCondition){
        return (long) mechanicalActionCostTable[mechanicalCondition.index][TIME_INDEX];
    }

    public void setOccurCost(MC mc, double cost){
        mechanicalActionCostTable[mc.index][OCCUR_INDEX] = cost;
    }

    public void setTimeCost(MC mc, long cost){
        mechanicalActionCostTable[mc.index][TIME_INDEX] = cost;
    }

    public void setActionCost(MC mc, double cost){
        mechanicalActionCostTable[mc.index][ACTION_INDEX] = cost;
    }

}
